<include file="Public/header" bdstyle="background:#f2f2f2"/>
<include file="Public/header_back"/> 
    <div class="product-wrap business-inspection product-address">
        <section>
            <span>{$goods_data.goods_name}</span>
        </section>
    </div>
    <article class="entrepreneurial-address">
        <div class="address-select flex-justify">
            <span>{$goods_data.goods_name}</span>
            <a href="javascript:void(0)">上海</a>
        </div>
        <div class="entrepreneurial-label">
        	<foreach name="keywords" item="val">
            <span>{$val}</span>
        	</foreach>
        </div>
        <div class="flex-justify entrepreneurial-price">
            <span><i>￥</i><font name="goods_price">{$goods_data.shop_price}</font></span>
            <span>最终价格以订单为准</span>
        </div>
   </article>
   <form id="dataForm">
   	   <input type="hidden" name="goods_id" value="{$goods_data.goods_id}"/>
   	   <input type="hidden" name="is_package" value="0"/>
   	   <if condition="$group_goods">
	   <article class="recommend">
	      <h3 class="recommend-product-title">推荐组合套餐</h3>
	      <foreach name="group_goods" item="val">
	      <section class="flex-align">
	          <div class="recommend-radio">
	            <input type="checkbox" name="recommend_goods[]" value="{$val.goods_id}"/>
	            <input type="hidden" name="price" value="{$val.goods.shop_price}"/>
	            <i class="iconfont"></i>
	          </div>
	          <div class="flex-1">
	            <div class="package-type flex-align">
	              <div></div>
	              <div class="flex-1 package-type-main">
	                <h3>{$val.goods.goods_name}</h3>
	                <p>{:cut_str(strip_tags(html_entity_decode($val['goods']['goods_desc'])),20)}</p>
	                <if condition="$val.goods.shop_price eq '0'">
	                	<span>免费</span>
	                <else/>
	                	<span><i>￥</i>{$val.goods.shop_price}</span>
	                </if>
	              </div>
	              <div class="line"></div>
	            </div>
	          </div>
	      </section>
		  </foreach>
	   </article>
	   </if>
   </form>
   <article class="product-detail">
      <h3 class="recommend-product-title">产品详情</h3>
      {$goods_data.goods_desc}
   </article>
   <article class="evaluate">
      <h3 class="recommend-product-title">用户评价</h3>
      <if condition="$comments">
	      <foreach name="comments" item="val">
	      <div class="evaluate-list">
	        <div class="flex-justify">
	            <span>{$goods_data.user_name}</span>
	            <span>{:date('Y-m-d H:i:s',$val['add_time'])}</span>
	        </div>
	        <p>{:nl2br($goods_data['content'])}</p>
	      </div>
	      </foreach>
      <else/>
      	  <div style="text-align:center;height:1rem;line-height:1rem;color:#888;">暂无评论！</div>
      </if>
   </article>
   <div class="foot-margin"></div>
   <footer class="flex-align total">
       <div class="flex-1">
           <div>合计 <strong><i>¥</i><span name="goods_price">{$goods_data.shop_price}</span></strong></div>
           <p>下单后请至未完成的订单中完善相关重要信息！</p>
       </div>
       <a href="javascript:void(0)" onclick="add_order('{$goods_data.}')">立即下单</a>
   </footer>
   <script>
    $(function(){
        $("input[name='recommend_goods[]']").change(function(){
    		setPrice()
    	})
    })
    function setPrice(){
    	var price = parseInt('{$goods_data.shop_price}');
    	$("input[name='recommend_goods[]']").each(function(){
    		if($(this).prop('checked')){
    			price += parseInt($(this).next('input').val());
    		}
    	});
    	$('*[name=goods_price]').html(price);
    }
    function add_order(){
    	$.post(
    		"{:U('Order/orderReady')}",
    		$('#dataForm').serializeArray(),
    		function(data){
    			if(data.status == '1'){
    				layer.msg(data.info);
    				setTimeout("location.href='"+data.url+"'",1000);
    			}else{
    				layer.msg(data.info);
    			}
    		}
    	)
    }
   </script>
<include file="Public/footer"/>


